<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
      <title>Tagged with curvevertex( ) - Processing 2.x and 3.x Forum</title>
      <link>https://forum.processing.org/two/discussions/tagged/feed.rss?Tag=curvevertex%28+%29</link>
      <pubDate>Sun, 08 Aug 2021 19:53:33 +0000</pubDate>
         <description>Tagged with curvevertex( ) - Processing 2.x and 3.x Forum</description>
   <language>en-CA</language>
   <atom:link href="/two/discussions/taggedcurvevertex%28+%29/feed.rss" rel="self" type="application/rss+xml" />
   <item>
      <title>Issue with PGraphic and curveVertex</title>
      <link>https://forum.processing.org/two/discussion/25874/issue-with-pgraphic-and-curvevertex</link>
      <pubDate>Mon, 08 Jan 2018 21:52:45 +0000</pubDate>
      <dc:creator>lolonulu</dc:creator>
      <guid isPermaLink="false">25874@/two/discussions</guid>
      <description><![CDATA[<p>Hello,</p>

<p>I have an issue with PGraphic. I try to test the color of an off screen PGraphic but it bounces back this error: 'ArrayIndexOutOfBoundsException: 1001'. I would really apreciate if someone can bring his fresh look and help me to solve this! Thank a lot in advance. Best, <a href="/two/profile/lolonulu">@lolonulu</a></p>

<pre><code>int X_Step=1;
int Y_Step=10;
int X, Y;
float radiousForce =50;
float maxForce =5;

PVector [][] points;

PGraphics pg;
PFont f;
color textColor = color(245);

void setup() {
  size(1000, 1000, P2D);
  background(0);

  f= createFont ("ARIAL", 150);
  fill(textColor);
  textFont(f);
  beginShape();
  pg = createGraphics(width, height);
  pg.smooth();
  pg.beginDraw();
  pg.fill(textColor);
  pg.textFont(f);
  pg.text("LIOR", 150, height/2+50);
  pg.endDraw();


  stroke(255);
  noFill();
  X =  (width/X_Step) +1;
  Y = (height/ Y_Step) +1;
  points = new PVector[X][Y];
  for (int x = 0; x&lt;X; x+=1) {
    for (int y=0; y&lt;Y; y+=1) {

      points [x][y] = new PVector(x*X_Step, y*Y_Step);
    }
  }
}
void draw() {
  background(0);



  if (pg.pixels[(int)points[X][Y].y*width +(int)points[X][Y].x] == textColor) {
    for ( int y=0; y &lt; Y; y+=1) {
      stroke(255);
      strokeWeight(1);

      beginShape();
      curveVertex(points[0][y].x, points[0][y].y);

      for (int x=0; x &lt; X; x+=1) {
        curveVertex(points[x][y].x, points[x][y].y);
      }
      curveVertex(points [X-1][y].x, points [X-1][y].y);
      endShape();
    }
  }
  if (mousePressed) {
    PVector mouse = new PVector(mouseX, mouseY);
    for (int x=0; x&lt;X; x+=1) {
      for (int y=0; y&lt;Y; y+=1) {
        float d =PVector. dist(points[x][y], mouse);
        if (d &lt; radiousForce) {
          PVector force= PVector.sub(points[x][y], mouse);
          force.normalize();
          force.mult(map(d, 0, radiousForce, maxForce, 0));
          points[x][y].add(force);
        }
      }
    }
  }
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Smooth a graph in Processing</title>
      <link>https://forum.processing.org/two/discussion/21769/smooth-a-graph-in-processing</link>
      <pubDate>Sun, 02 Apr 2017 18:58:42 +0000</pubDate>
      <dc:creator>cygig</dc:creator>
      <guid isPermaLink="false">21769@/two/discussions</guid>
      <description><![CDATA[<p>I am making a program to generate a battery discharge graph for accessing the capacity of batteries (because Excel is too slow and troublesome).</p>

<p>I average a group of values together to make my graph smoother, and I am wondering if there are other methods to draw smoother graphs in Processing. I heard of methods like regression and best-fit curves, but I never knew how they can be implemented in Processing, and to be honest, I am math ability is abysmal.</p>

<p>Any input and advices will be welcome!</p>

<p>Here is my graph:
<img src="http://i.imgur.com/WZqYwm2.png" alt="" /></p>

<p>Here is the one generated by the electronic dummy load software:
<img src="http://i.imgur.com/MGjqUvb.png" alt="" /></p>

<p>I would prefer to generate my own graph to control the design and be able to output in a vector file.</p>

<p>And here is a part of my code:</p>

<pre><code>String fname = "Trustfire 14500 900mAh 0.5A.csv";
CellData cellData = new CellData();
float[] voltage;
float[] capacity;

void setup(){
  size(800, 600);
  background(255);
  cellData.readCSV(fname);

  voltage = cellData.toMappedArray("voltage", 550, 50);
  voltage = bandAvg(voltage, 50);

  capacity = cellData.toMappedArray("capacity", 50, 750);
  capacity = bandAvg(capacity, 50);


  beginShape();
  for (int i=0; i&lt;voltage.length; i++){
    vertex(capacity[i],voltage[i]);    
  }
  endShape();


}

void draw(){
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>How to check whether mouse is inside curve vertex?</title>
      <link>https://forum.processing.org/two/discussion/17784/how-to-check-whether-mouse-is-inside-curve-vertex</link>
      <pubDate>Mon, 08 Aug 2016 08:49:30 +0000</pubDate>
      <dc:creator>manu354</dc:creator>
      <guid isPermaLink="false">17784@/two/discussions</guid>
      <description><![CDATA[<p>Hi, i'm making an interactive video for my school project where the user can make choices by clicking objects on the end frame of a video. I'm doing this in p5.js, I didn't put it in that sub category because I feel that the answer to my question will also be helpful for normal processing.</p>

<p>What I want to do is outline the shape (of a person for example) with a closed curve vertex and then test to see if mouse is clicked inside that area. I really have no idea how to this for complex shapes such as a curve vertex! Any help would be much appreciated!</p>

<p>Thank you,
Manu</p>
]]></description>
   </item>
   <item>
      <title>texture on curveVertex - problem</title>
      <link>https://forum.processing.org/two/discussion/11504/texture-on-curvevertex-problem</link>
      <pubDate>Mon, 29 Jun 2015 20:57:02 +0000</pubDate>
      <dc:creator>kmarkusk</dc:creator>
      <guid isPermaLink="false">11504@/two/discussions</guid>
      <description><![CDATA[<p>Hi Processing Forum,</p>

<p>I am working on a graphic and tried to add a structure, what is not working.
Does anybody has an advice for me?
Thanks a lot.</p>

<p>Markus</p>

<p>import ddf.minim.*;
import processing.pdf.*;
PImage img;</p>

<p>boolean record;</p>

<p>Minim minim;
AudioInput input;</p>

<p>void setup() {</p>

<p>size(displayWidth, displayHeight,  P3D);
minim = new Minim (this);
input = minim.getLineIn (Minim.STEREO, 512);
noCursor(); 
img = loadImage("bild.jpg");
}</p>

<p>void draw() {</p>

<p>if(record){
    beginRaw(PDF, "output.pdf");
  }</p>

<p>float dim = input.mix.level () * width;
translate(width/2, height/2, 0);</p>

<p>pushMatrix();
scale(0.9);</p>

<p>rotateX(PI/2);
rotateZ(-PI/10);</p>

<p>beginShape();
texture(img);
background(19,19,19);</p>

<p>smooth();</p>

<p>//stroke(255,175,0);
stroke(255);
strokeWeight(1.8);</p>

<p>scale(0.9);
smooth();</p>

<p>rotateX(frameCount/700.0);
  rotateY(frameCount/600.0);
  rotateZ(frameCount/200.0);</p>

<p>curveVertex( mouseX, 320, -120);
curveVertex(-250, -dim, -mouseX);
curveVertex(   -mouseY,   -190,  mouseX);</p>

<p>curveVertex(-260, -dim, mouseX);
curveVertex(-dim, -190, -210);
curveVertex(   mouseX,    -mouseY,  dim);</p>

<p>curveVertex(-160, -mouseX, -290);
curveVertex(-dim, dim, -210);
curveVertex(   100,    140,  dim);</p>

<p>curveVertex(-mouseY, mouseX, -390);
curveVertex(-dim, dim, -210);
curveVertex(  mouseY,    240,  dim);</p>

<p>curveVertex( 120, -220, mouseX);
curveVertex( 290,  dim, dim);
curveVertex(  dim,    dim,  mouseY);</p>

<p>fill(255);</p>

<p>curveVertex(mouseX, 220, -150);
curveVertex(-dim, 110, dim);
curveVertex(   -mouseY,   -150,  mouseY);</p>

<p>curveVertex( mouseX, 220, -dim);
curveVertex(-350, -dim, -220);
curveVertex(   mouseX,   210,  -mouseX);</p>

<p>curveVertex(mouseX,  dim, -200);
curveVertex(-110, dim, mouseY);
curveVertex(   230,    dim,  -mouseY);</p>

<p>curveVertex(340,  dim, -325);
curveVertex(mouseY, dim, -135);
curveVertex(   -dim,    -mouseY,  mouseY);
endShape();
popMatrix();</p>

<p>pushMatrix();
fill(19,19,19);
noStroke();
rectMode(CENTER);
//rect(0,0,500,500);
popMatrix();</p>

<p>if (record) {
    endRaw();
    record = false;
  }</p>

<p>endShape(CLOSE);</p>

<p>}</p>

<p>//boolean sketchFullScreen() {
//return true;
//}</p>

<p>void keyPressed() {
  if (key == 'r') {
    record = true;
  }
}</p>
]]></description>
   </item>
   <item>
      <title>Android and java mode colour difference</title>
      <link>https://forum.processing.org/two/discussion/7507/android-and-java-mode-colour-difference</link>
      <pubDate>Wed, 08 Oct 2014 12:22:32 +0000</pubDate>
      <dc:creator>farhad</dc:creator>
      <guid isPermaLink="false">7507@/two/discussions</guid>
      <description><![CDATA[<p>Dear processing community, when i run the following code in java mode i get accurate colors on the image but when i switch to android mode i get  an unexpected result. Does anyone know why is it happening and how to overcome this ?</p>

<pre><code>PImage img;
void setup()
{
  size (displayWidth,displayHeight);
  img = loadImage("foot2.png");
}
void draw()
{
  background(0);

image(img,50,70);

beginShape();// 
fill(255,0,0);
 curveVertex(170,76);
 curveVertex(169,138);
 curveVertex(168,148);
 curveVertex(169,148);
 curveVertex(213,157);
 curveVertex(211,107);
 curveVertex(193,79);
 curveVertex(170,76);
 curveVertex(159,108);
 curveVertex(168,148);
endShape();
fill(0,2,5);
  ellipse(185,108 ,40,50); 
beginShape(); // 
fill(190,29,83);
curveVertex(183,212);
 curveVertex(216,213);
curveVertex(216,204);
 curveVertex(212,184);
 curveVertex(182,186);
curveVertex(183,212);
 curveVertex(216,213);
curveVertex(216,204);
endShape();

beginShape(); // 
fill(255,244,13);
 curveVertex(184,212);
 curveVertex(153,213);
 curveVertex(157,188);
 curveVertex(181,188);
  curveVertex(184,212);
 curveVertex(153,213);
 curveVertex(157,188);
endShape();

beginShape(); // 
fill(255,0,0);
curveVertex(152,213);
curveVertex(136,211);
 curveVertex(114,218);
 curveVertex(115,199);
curveVertex(154,189);
curveVertex(152,213);
curveVertex(138,214);
curveVertex(124,215);
 curveVertex(114,218);
endShape();

beginShape(); // 

fill(255);
 curveVertex(115,218);
 curveVertex(91,219);
 curveVertex(77,218);
 curveVertex(91,198);
 curveVertex(110,203);
 curveVertex(115,218);
 curveVertex(91,219);
  curveVertex(77,218);
endShape();

beginShape(); //
fill(0,0,255);
 curveVertex(77,217);
 curveVertex(90,238);
 curveVertex(84,256);
 curveVertex(66,256);
 curveVertex(62,221);
 curveVertex(72,215);
 curveVertex(77,217);
 curveVertex(90,238);
 curveVertex(84,256);
endShape();
}
</code></pre>

<p><img src="http://forum.processing.org/two/uploads/imageupload/208/S3Z8O62BMB7A.png" alt="Untitled54" title="Untitled54" /></p>
]]></description>
   </item>
   </channel>
</rss>